/**
 * 
 */
package clids.ex2.filters;

import java.io.File;

/**
 * @author Li0r
 *
 */

public class SmallerThanFilter extends AbstractFilter {
	
	private static final int K_FACTOR = 1024;
	private double high;
	
	public SmallerThanFilter(String params) {
		super(params);
		high = Double.parseDouble(parameters[0]);
	}
	public SmallerThanFilter(double num){
		high = num;
	}
	@Override
	public boolean isValid(String file) {
		File fileInfo = new File(file);
		if((fileInfo.length() / K_FACTOR) <= high){
			return true;
		}
		return false;
	}

}
